package wwl.lsf.hellospringboot.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CorsFilterConfig implements WebMvcConfigurer {
//解决了跨域问题
  @Override
  public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/**")
        .allowedOrigins("http://localhost","http://wwl.lsf","http://47.93.4.194")
        .allowedMethods("*")
        //如果浏览器开启了Disable cache 每次都会发送预检请求的
        .maxAge(20);
  }
}
